import request from '@/utils/request'

// 获取经纪名单
export const getAgent = () => request({
  url: '/agents'
})

// 获取房产信息
export const getProperty = (params) => request({
  url: '/properties',
  params
})

// 添加房产接口
export const addProperty = (data) => request({
  url: '/properties',
  method: 'post',
  data
})

// 获取房产数量
export const propertyCount = (params) => request({
  url: '/properties/count',
  params
})

export const delProperty = (id) => request({
  url: `/properties/${id}`,
  method: 'delete'
})

// 编辑房产接口
export const editProperty = (data) => request({
  url: `/properties/${data.id}`,
  method: 'put',
  data
})

// 根据id获取当前房产信息
export const getPropertyDetail = (id) => request({
  url: `/properties/${id}`
})

// 获取高德地图数据
export const getMap = () => {
  return request({
    url: 'https://restapi.amap.com/v3/config/district',
    params: {
      key: '791c5583274cf092b3dbdcc70c857323',
      subdistrict: 3
    },
    noToken: true
  })
}
